

// 1/21/2013 10:54:15 PM -- adds image handling

var jmolApplet0; // set up in HTML table, below

// logic is set by indicating order of USE -- default is HTML5 for this test page, though
var use = "HTML5" // JAVA HTML5 WEBGL IMAGE  are all otions
var s = document.location.search;


// Developers: The _debugCode flag is checked in j2s/core/core.z.js, 
// and, if TRUE, skips loading the core methods, forcing those
// to be read from their individual directories. Set this
// true if you want to do some code debugging by inserting
// System.out.println, document.title, or alert commands
// anywhere in the Java or Jmol code.

Jmol._debugCode = (s.indexOf("debugcode") >= 0);

jmol_isReady = function(applet) {
	Jmol._getElement(applet, "appletdiv").style.border="none"
}		

var xxxx = document.location.search
if (xxxx.indexOf("_USE=") > 0)xxxx = xxxx.substring(0, xxxx.indexOf("_USE=") - 1);
if (xxxx.length == 5 || xxxx.length == 0) { 
	xxxx = (xxxx + "?1crn").substring(1,5)
	script = 'h2oOn=true;set animframecallback "jmolscript:if (!selectionHalos) {select model=_modelNumber}";'
	+'set errorCallback "myCallback";'
	+'set defaultloadscript "isDssp = false;set defaultVDW babel;if(!h2oOn){display !water}";'
	+'set zoomlarge false;set echo top left;echo loading XXXX...;refresh;'
	+'load "http://www.rcsb.org/pdb/files/XXXX.pdb";set echo top center;echo XXXX;'
	+'spacefill off;wireframe off;cartoons on;color structure;spin on;'
	script = script.replace(/XXXX/g, xxxx)
} else {
	script = unescape(xxxx.substring(1))
}


var Info = {
	width: 450,
	height: 450,
	debug: false,
	color: "white",
	addSelectionOptions: false,
	serverURL: "http://chemapps.stolaf.edu/jmol/jsmol/php/jsmol.php",
	use: "HTML5",
	j2sPath: "j2s",
	readyFunction: jmol_isReady,
	script: script,
	//jarPath: "java",
	//jarFile: (useSignedApplet ? "JmolAppletSigned.jar" : "JmolApplet.jar"),
	//isSigned: useSignedApplet,
	//disableJ2SLoadMonitor: true,
	disableInitialConsole: true
	//defaultModel: "$dopamine",
	//console: "none", // default will be jmolApplet0_infodiv
}

Models = []

template = "xid='%1';load =%1|%2 (%1)"
function addModel(xxxx, text) {
 Models.push(template.replace(/\%1/g, xxxx).replace(/%2/g, text).split("|"))
}

addModel("1crn", "small")
addModel("1blu","Fe/S")
addModel("1bna","b-DNA")
addModel("1d66","transcription")

// these are conveniences that mimic behavior of Jmol.js

function jmolCheckbox(script1, script0,text,ischecked) {Jmol.jmolCheckbox(jmolApplet0,script1, script0, text, ischecked)}
function jmolButton(script, text) {Jmol.jmolButton(jmolApplet0, script,text)}
function jmolHtml(s) { document.write(s) };
function jmolBr() { jmolHtml("<br />") }
function jmolMenu(a) {Jmol.jmolMenu(jmolApplet0, a)}
 


